import http from '@/common/http.js'

export async function getUserOrders(data) { //获取用户订单列表
	return await http({
		url: '/order/getUserOrders/' + data.type,
		method: 'GET',
		data: data
	})
}
export async function createOrder(data) { //用户创建订单
	return await http({
		url: '/order/create',
		method: 'POST',
		data: data
	})
}
export async function getOrderdetail(data) { //根据ID获取订单详情信息
	return await http({
		url: '/order/getOrder/' + data.id,
		method: 'GET'
	})
}
export async function updateOrder(data) { //修改订单信息
	return await http({
		url: '/order/updateOrder',
		method: 'POST',
		data: data
	})
}
export async function cancelOrder(data) { //取消订单
	return await http({
		url: '/wx/pay/refunds/' + data.id,
		method: 'GET'
	})
}
export async function payOrder(data) { //发起微信支付下单
	return await http({
		url: '/wx/pay/transactions/' + data.id,
		method: 'GET'
	})
}
export async function advanceStatus(data) { //订单状态推进
	return await http({
		url: '/order/advanceStatus/' + data.id,
		method: 'GET'
	})
}
export async function payOrderappend(data) { //追加服务发起微信支付下单
	return await http({
		url: '/wx/append/transactions/' + data.code,
		method: 'GET'
	})
}
export async function addComment(data) { //用户发表订单评论
	return await http({
		url: '/comm/add',
		method: 'POST',
		data: data
	})
}
export async function getOrderamount(data) { //计算订单价格
	return await http({
		url: '/order/tally',
		method: 'GET',
		data: data
	})
}
export async function getSalesorder(data) { //获取用户售后列表
	return await http({
		url: '/aftersales/list/' + data.type,
		method: 'GET'
	})
}
export async function createSalesorder(data) { //创建用户售后
	return await http({
		url: '/aftersales/create',
		method: 'POST',
		data: data
	})
}
export async function getCommonorder(data) { //获取用户评论订单列表
	return await http({
		url: '/comm/list/' + data.type,
		method: 'GET'
	})
}
export async function getOrdercominfo(data) { //用户查看订单评论
	return await http({
		url: '/comm/userComm/' + data.id,
		method: 'GET'
	})
}

export async function getGoodsComment(orderType, goodType = 0) { //商品评论
	return await http({
		url: `/comm/${orderType}/${goodType}`,
		method: 'GET'
	})
}